package com.pdg.islandinterloper.clientstatehandlers;

import android.view.MenuItem;
import android.view.View;

import com.pdg.islandinterloper.MainActivity;
import com.pdg.islandinterloper.R;
import com.pdg.islandinterloper.baseclasses.ClientStateHandlerBase;
import com.pdg.islandinterloper.enums.ClientState;

public class PlayClientStateHandler extends ClientStateHandlerBase<MainActivity> {

	public PlayClientStateHandler(MainActivity theActivity) {
		super(theActivity);
	}

	@Override
	public void handleShow() {
		if(getActivity().getDatabase().getProfileTableProvider().hasProfiles()){
			getActivity().findViewById(R.id.button_open_profile).setEnabled(true);
		}else{
			getActivity().findViewById(R.id.button_open_profile).setEnabled(false);
		}
	}

	@Override
	public void handleButtonClick(View theView) {
		switch(theView.getId()){
		case R.id.button_back:
			getActivity().setState(ClientState.MAIN);
			break;
		case R.id.button_new_profile:
			getActivity().setState(ClientState.NEW_PROFILE);
			break;
		case R.id.button_open_profile:
			getActivity().setState(ClientState.OPEN_PROFILE);
			break;
		}
	}

	@Override
	public boolean handleMenu(MenuItem theItem) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void handleHide() {
		// TODO Auto-generated method stub

	}

}
